package com.aytbayev.asyl;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

import android.content.res.Resources;

public class MyInstrument {
	private int instrument_id;
	private String Full_Ticker;
	private String nin;
	private String instrument_name;
	private float free_amount;
	private String currency_name;	
	private float blocked_amount;
	private byte isBond;
	private String holdingPlace;
	private int FT_ID;
	
	public MyInstrument() {		
	}
	
	public int getInstumentId() {
		return instrument_id;
	}
	
	public String getFullTicker() {
		return Full_Ticker;
	}
	
	public String getNin() {
		return nin;
	}
	
	public String getInstrumentName() {
		return instrument_name;
	}
	
	public String getCurrencyName(Resources r) {		
		if (currency_name.equals(r.getString(R.string.GBP_replace))) {
            return "GBP";
	    } else if (currency_name.equals(r.getString(R.string.USD_replace))) {
	            return "USD";
	    } else if (currency_name.equals(r.getString(R.string.KZT_replace))) {
	            return "KZT";
	    } else {
	            return currency_name;
	    }
	}
		
	public float getFreeAmount() {
		return free_amount;
	}
	
	public float getBlockedAmount() {
		return blocked_amount;
	}
	
	public byte isBond() {
		return isBond;
	}
	
	public String getHoldingPlace() {
		return holdingPlace;
	}
	
	public String format(float a) {
		if ( a != 0){
			DecimalFormatSymbols formatSymbols =  new DecimalFormatSymbols();
		    formatSymbols.setGroupingSeparator(' ');
	
		    DecimalFormat myFormatter = new DecimalFormat("###,###.##", formatSymbols);
		    return myFormatter.format(a);
		} else {
			return "0";
		}
	}
}
